interface Menu {
  id: number;
  title: string;
  url: string;
  parent: number | null;
  icon?: string;
  sorts?: number;
  conditions?: number;
  desc?: string;
}

// 一级类目
const lv1: Menu[] = [
  {
    id: 1,
    title: "首页",
    icon: "icon-home",
    url: "/home",
    parent: null,
  },
  // {
  //   id: 2,
  //   title: "用户管理",
  //   icon: "icon-user",
  //   url: "/system",
  //   parent: null,
  // },
  {
    id: 3,
    title: "协同办公",
    icon: "icon-crown",
    url: "/excel",
    parent: null,
  },
];

// 所有的菜单数据
const lv2: Menu[] = [
  // 仪表盘
  {
    id: 100,
    title: "工作台",
    url: "/home/index",
    parent: 1,
  },

  // 用户管理
  {
    id: 200,
    title: "用户基本信息",
    url: "/system/useradmin",
    parent: 2,
  },
  {
    id: 201,
    title: "角色管理",
    url: "/system/roleadmin",
    parent: 2,
  },
  {
    id: 202,
    title: "功能管理",
    url: "/system/menuadmin",
    parent: 2,
  },
];

function init() {
  const l1 = lv1.map((item, index) => {
    return {
      ...item,
      sorts: index,
      desc: item.desc || item.title,
      conditions: 1,
    };
  });
  const l2 = lv2.map((item, index) => {
    return {
      ...item,
      sorts: index,
      desc: item.desc || item.title,
      conditions: 1,
    };
  });
  console.log("menu初始化", l1, l2);
  return [...l1, ...l2];
}

const menus = init();
export default menus;

// sorts, desc, conditions， icon
